package com.haredot.vo;

import com.github.pagehelper.IPage;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.StringJoiner;

/**
 * 分页对象
 */
public class PageVo implements IPage, Serializable {

    @Serial
    private static final long serialVersionUID = 9067267146201371573L;

    private Integer page ;

    private Integer rows ;
    /**
     * 总条数
     */
    private Long total ;
    /**
     * 显示数据
     */
    private List<?> list ;

    public PageVo(Integer page, Integer rows) {
        this.page = page;
        this.rows = rows;
    }


    @Override
    public Integer getPageNum() {
        return page;
    }

    @Override
    public Integer getPageSize() {
        return rows;
    }

    @Override
    public String getOrderBy() {
        return null;
    }

    public Long getTotal() {
        return total;
    }

    public PageVo setTotal(Long total) {
        this.total = total;
        return this ;
    }

    public List<?> getList() {
        return list;
    }

    public PageVo setList(List<?> list) {
        this.list = list;
        return this ;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", PageVo.class.getSimpleName() + "[", "]")
                .add("page=" + page)
                .add("rows=" + rows)
                .toString();
    }
}
